public class box {
    private int products = 0;
    public synchronized void product() throws InterruptedException {
        if (products < 5)
            products ++ ;
        else  wait();
    }
    public synchronized  int get_product() throws InterruptedException {

        if (products <= 0)
            notifyAll();
        products --;
        return  products + 1;

    }
}
